package com.gitee.xmhzzz.rocketmq.spring.boot.quick.controller;

import com.gitee.xmhzzz.rocketmq.spring.boot.quick.common.Result;
import com.gitee.xmhzzz.rocketmq.spring.boot.quick.controller.req.SendMsgReq;
import com.gitee.xmhzzz.rocketmq.spring.boot.quick.service.ExampleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName ExampleController
 * @Description
 * @Author wzq
 * @Date 2024/12/10 13:43
 * @Version 1.0
 */
@RestController
@RequestMapping("/example")
public class ExampleController {

    @Autowired
    private ExampleService exampleService;

    @PostMapping("/send-msg")
    public Result<Void> sendMsg(@RequestBody SendMsgReq req){
        exampleService.sendMsg(req);
        return Result.ok();
    }

    @PostMapping("/async-send-msg")
    public Result<Void> asyncSendMsg(@RequestBody SendMsgReq req){
        exampleService.asyncSendMsg(req);
        return Result.ok();
    }

    @PostMapping("/send-one-way-msg")
    public Result<Void> sendOneWayMsg(@RequestBody SendMsgReq req){
        exampleService.sendOneWayMsg(req);
        return Result.ok();
    }

    @PostMapping("/send-orderly-msg")
    public Result<Void> sendOrderlyMsg(@RequestBody SendMsgReq req){
        exampleService.sendOrderlyMsg(req);
        return Result.ok();
    }

    @PostMapping("/send-delayed-msg")
    public Result<Void> sendDelayedMsg(@RequestBody SendMsgReq req){
        exampleService.sendDelayedMsg(req);
        return Result.ok();
    }


}
